package cn.tedu.coolshark1.controller;

import cn.tedu.coolshark1.mapper.BannerMapper;
import cn.tedu.coolshark1.pojo.entity.Banner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;
import java.util.List;

@RestController
@RequestMapping("/banner")
public class BannerController {
    @Autowired(required = false)
    BannerMapper mapper;
    @RequestMapping("/select")
    public List<Banner> select(){
        return mapper.select();
    }
    @RequestMapping("/delete")
    public void delete(int id){
        String url = mapper.selectUrlById(id);
        new File("d:/files"+url).delete();
        mapper.deleteById(id);
    }




}
